<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>EventNotification</title>
</head>
<body>
<h1>
时间定时通知器
</h1>

<h2 id="clock"></h2>
<script>
"use strict"
  var eventNotification={
    init:function(){},
    sendNotification:function (){
      if(eventNotification.checkTimer()){
        if(window.Notification){
          Notification.requestPermission();
          const notification=new Notification("New Message",{
            body:"Come From Robot Casper",
            silent:true,
            icon:"https://res.gengesports.cn/user-web/images/logo-dark.png"
          })
          notification.onclick=(e)=>{
            window.open("https://www.skylinewebcams.com/zh/webcam/maldives/north-male-atoll/meerufenfushi/meeru-island-beach.html","relax")
            window.focus();
            notification.close()
          }
        }
        else{
          this.message.warn("sorry,can not support web notification")
        }
      }
    },
    checkTimer:function(){
      return new Date().getMinutes() === 45;

    }

  }
  let setColocker=function(){
    document.getElementById("clock").innerText=new Date().toLocaleString()
  }
    let EventTimer=setInterval(eventNotification.sendNotification,(1000*60))
    let setTimer=setInterval(setColocker,1000)
  // clearInterval(timer)
//动作 发送通知  时间到点判断
</script>
</body>
</html>